package com.tledu.spring.core.likou;

import java.util.BitSet;
import java.util.Properties;
import java.util.Stack;

/**
 * @author Lsj
 * @version 1.0
 * @date 2021/7/8 19:38
 */
public class MappingLearning {
    public static void main(String[] args) {
        // 创建一个空的属性映射
        Properties properties0 = new Properties();
        // 创建一个带有一组默认值的空的属性映射
        Properties properties1 = new Properties(properties0);
        properties1.setProperty("admin","root");
        properties1.setProperty("lsj","lsj");
        System.out.println(properties1.getProperty("lsj"));
        System.out.println("----");
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        stack.push(5);
        System.out.println("返回栈顶元素,但是不弹出"+stack.peek());
        // 这里弹栈会出现弹不完的情况,因为每次stack.size的值都是不一样的,所以出现出栈不完全的情况
        for (int i = 0; i < stack.size(); i++) {
            System.out.println(stack.pop());
        }
        System.out.println("可能会出错"+stack.pop());
        System.out.println("----");
        // 创建一个位集
        BitSet bitSet = new BitSet();
        // 当给位集的index设置属性的时候会变成true
        bitSet.set(1);
        System.out.println(bitSet.get(1));
        System.out.println(bitSet.get(2));
    }
}
